//==================================================================================
//						Popup definition & variable description
//==================================================================================
//#define	POP_X_MAIN_NUM_H		9
//#define	POP_X_MAIN_NUM_V		7
//#define	POP_Y_MAIN_NUM_H		9
//#define	POP_Y_MAIN_NUM_V		7
#define	POP_MN_NUM_H		9
//#if defined(__WTH_ADO__)
	#define	POP_MN_NUM_V		5
//#elif defined(__WTH_VGA__)
//	#define	POP_MN_NUM_V		4//5			//... because of VGA board detection
//#endif

//extern U8 idata	wndw_pop_sub_num_h;
//extern U8 idata	wndw_pop_sub_num_v;

//Copy from Mse.c of tw2835
//U8	mse_osd_x=45;//50;//
//U8	mse_osd_y=56;//28;//30;//
//U8	mse_osd_x_sub=45;//50;//
//U8	mse_osd_y_sub=56;//30;//
//==================================================================================
/*#define		POP_POS_DS				0
#define		POP_POS_DS_SC			0x00
#define		POP_POS_DS_SR			0x10
//#define		POP_POS_DS_PB			0x10
#define		POP_POS_ZM			0x20
#define		POP_POS_DS_IN			0x30
//#define	POP_POS_CH						1
//#define	POP_POS_ZM						1
#define		POP_POS_RC				1
#define		POP_POS_RC_FM			0x01
#define		POP_POS_RC_IN			0x11
#define		POP_POS_RC_NR			0x21
#define		POP_POS_MTN			2
#define		POP_POS_MTN_MD		0x02
#define		POP_POS_MTN_BD		0x12
#define		POP_POS_MTN_ND		0x22

#if defined(__WTH_ADO__)
	#define		POP_POS_ADO					3
	#define		POP_POS_ADO_GN				0x03
	#define		POP_POS_ADO_LV				0x13
	#define		POP_POS_ADO_RC				0x23
	//#define		POP_POS_ADO_DT				0x35
	#define		POP_POS_RG						4
#elif defined(__WTH_VGA__)
	#define		POP_POS_VGA					3
	#define		POP_POS_VGA_OR				0x03
	#define		POP_POS_VGA_DI				0x13
	#define		POP_POS_VGA_IE				0x23
	#define		POP_POS_VGA_NR				0x33
	#define		POP_POS_RG						3//5			//... because of VGA board detection
#endif
#define	POP_POS_ABT							5//6       //change 6 to 5 for osd test (070905)
//#define	POP_POS_RG							0
//#define	POP_POS_SCRN_X						1
//#define		POP_POS_SCRN_X_FL			0x01
//#define		POP_POS_SCRN_X_QD			0x11
//#define		POP_POS_SCRN_X_NRT		0x21
//#define	POP_POS_SCRN_Y						1
//#define		POP_POS_SCRN_Y_QD			0x01
//#define		POP_POS_SCRN_Y_CIF		0x11
//#define		POP_POS_SCRN_Y_MUX		0x21

//U8 idata	wndw_pop_crnt_ch;
//U8 idata	wndw_crnt_dvc;
//U8 idata	wndw_crnt_ch;
//... wndw_mn_pos_crnt : Use bit[7 - 4] for popup_sub_pos when enter the popup sub menu
//U8 idata	wndw_mn_pos_crnt;
*/


//==================================================================================
//						Popup function description
//==================================================================================
//void SetPopMainOSD(U8, U8, U8);
//void SetPopMain(U8, U8, U8, U8, U8);
//void SetPopSubOSD(U8, U8, U8, U8);
//void SetPopSub(U8, U8, U8, U8, U8, U8);
//void RemovePopMain();
//void CreatePopMain();
void RemoveOSDFnt(U8, U16, U8, U16);
//void CreatePopSub(U8);
//void RunPopProc();

/*
U8 idata wndw_pop_sub_num_h;
U8 idata wndw_pop_sub_num_v;

U8 idata	wndw_pop_crnt_ch;
U8 idata	wndw_crnt_dvc;
U8 idata	wndw_crnt_ch;
U8 idata	wndw_mn_pos_crnt = 30;
*/
//==================================================================================
//						Popup function description
//==================================================================================
/*void SetPopMainOSD(U8 _pth, U8 _pos_x, U8 _pos_y)
{
	if(BitSet(_pth,PTH_X)){//change to x path for test (070904)
		WriteOSDStrY(MASTER,_pos_x,_pos_y+POP_POS_DS,0x00,str_page0_system);
		WriteOSDStrY(MASTER,_pos_x,_pos_y+POP_POS_RC,0x00,str_page0_display);
		WriteOSDStrY(MASTER,_pos_x,_pos_y+POP_POS_MTN,0x00,str_page0_camera);
		WriteOSDStrY(MASTER,_pos_x,_pos_y+POP_POS_ADO,0x00,str_page0_auto);
		WriteOSDStrY(MASTER,_pos_x,_pos_y+POP_POS_RG,0x00,str_page0_motion);  //(POP_POS_RG+cmn_vga_det)
		WriteOSDStrY(MASTER,_pos_x,_pos_y+POP_POS_ABT,0x00,str_page0_event);
		WriteOSDStrY(MASTER,_pos_x,_pos_y+POP_POS_ABT+1,0x00,str_page0_report);
	}
	if(BitSet(_pth,PTH_Y)){
		WriteOSDStrY(MASTER,_pos_x,_pos_y+POP_POS_DS,0x00,str_wndw_pop_ds);
		WriteOSDStrY(MASTER,_pos_x,_pos_y+POP_POS_RC,0x00,str_wndw_pop_rc_sb);
		WriteOSDStrY(MASTER,_pos_x,_pos_y+POP_POS_MTN,OSD_MIX,str_wndw_pop_mtn);
		WriteOSDStrY(MASTER,_pos_x,_pos_y+POP_POS_ADO,0x00,str_wndw_pop_ado);
		WriteOSDStrY(MASTER,_pos_x,_pos_y+POP_POS_RG,0x00,str_wndw_pop_rg);  //(POP_POS_RG+cmn_vga_det)
	}
}*/
//==================================================================================
/*void SetPopMain(U8 _pth, U8 _pos_x, U8 _pos_y, U8 _lngth, U8 _hght) //Drawing main Box and Downloading main OSD string in OSD_BUF 
{
//	_lngth = 0;			//... temporal
//	_hght = 0;			//... temporal
	CreateBoxPopFrame(_pth,BOX_POP_MN,_pos_x,_pos_y,_lngth,_hght);
//	IfBitSet(_pth,PTH_X)	SetPopMainOSD(PTH_X,_pos_x,_pos_y);
//	IfBitSet(_pth,PTH_Y)	SetPopMainOSD(PTH_Y,_pos_x,_pos_y);
	if(BitSet(_pth,PTH_X))	SetPopMainOSD(PTH_X,_pos_x,_pos_y);
	if(BitSet(_pth,PTH_Y))	SetPopMainOSD(PTH_Y,_pos_x,_pos_y);
}*/
//==================================================================================
/*void SetPopSubOSD(U8 _pth, U8 _pos_x, U8 _pos_y, U8 _main_mn_pos_crnt)   //Set property OSD string for each sub
{
//	U8 _t1_;

//	IfBitSet(_pth,PTH_X){
//	if(BitSet(_pth,PTH_X)){
//		if(_main_mn_pos_crnt == POP_POS_SCRN_X){
////			WriteOSDStrX(MASTER,_pos_x,_pos_y+0,0x00,str_wndw_pop_scrn_x_fl);
////			WriteOSDStrX(MASTER,_pos_x,_pos_y+1,0x00,str_wndw_pop_scrn_x_qd);
////			WriteOSDStrX(MASTER,_pos_x,_pos_y+2,0x00,str_wndw_pop_scrn_x_nrt);
//			WriteOSDStrY(MASTER,_pos_x,_pos_y+0,0x00,str_wndw_pop_scrn_x_fl);
//			WriteOSDStrY(MASTER,_pos_x,_pos_y+1,0x00,str_wndw_pop_scrn_x_qd);
//			WriteOSDStrY(MASTER,_pos_x,_pos_y+2,0x00,str_wndw_pop_scrn_x_nrt);
//		}
//	}
////	IfBitSet(_pth,PTH_Y){
//	if(BitSet(_pth,PTH_Y)){
//		if(_main_mn_pos_crnt == POP_POS_SCRN_Y){
//			WriteOSDStrY(MASTER,_pos_x,_pos_y+0,0x00,str_wndw_pop_scrn_y_qd);
//			WriteOSDStrY(MASTER,_pos_x,_pos_y+1,0x00,str_wndw_pop_scrn_y_cif);
//			WriteOSDStrY(MASTER,_pos_x,_pos_y+2,0x00,str_wndw_pop_scrn_y_mux);
//		}
//	}
	if(BitSet(_pth,PTH_X)){
		if(_main_mn_pos_crnt == POP_POS_DS){
			WriteOSDStrY(MASTER,_pos_x,_pos_y+0,0x00,str_wndw_pop_sb_scrn);
#if defined(__4CH__)
			if((wndw_ds_sc_fmt == SC_FMT_4CH)&&(b_ds_wth_4pb))
#elif defined(__16CH__)
			if((wndw_ds_sc_fmt == SC_FMT_16CH)&&(b_ds_wth_16pb))
#endif
				WriteOSDStrY(MASTER,_pos_x,_pos_y+1,OSD_MIX,str_wndw_pop_sb_src);
			else
				WriteOSDStrY(MASTER,_pos_x,_pos_y+1,0x00,str_wndw_pop_sb_src);
			WriteOSDStrY(MASTER,_pos_x,_pos_y+2,0x00,str_wndw_pop_zm);
			WriteOSDStrY(MASTER,_pos_x,_pos_y+3,0x00,str_wndw_pop_sb_indx);
		}
		else if(_main_mn_pos_crnt == POP_POS_MTN){
			WriteOSDStrY(MASTER,_pos_x,_pos_y+0,0x00,str_wndw_pop_sb_mtn);
			WriteOSDStrY(MASTER,_pos_x,_pos_y+1,0x00,str_wndw_pop_sb_blnd);
			WriteOSDStrY(MASTER,_pos_x,_pos_y+2,0x00,str_wndw_pop_sb_nght);
		}
#if defined(__WTH_ADO__)
		else if(_main_mn_pos_crnt == POP_POS_ADO){
			WriteOSDStrY(MASTER,_pos_x,_pos_y+0,0x00,str_wndw_pop_sb_gn);
			WriteOSDStrY(MASTER,_pos_x,_pos_y+1,0x00,str_wndw_pop_sb_lv);
			WriteOSDStrY(MASTER,_pos_x,_pos_y+2,0x00,str_wndw_pop_sb_rc);
//			WriteOSDStrY(MASTER,_pos_x,_pos_y+3,0x00,str_wndw_pop_sb_dt);
		}
#elif defined(__WTH_VGA__)
//		else if(_main_mn_pos_crnt == POP_POS_VGA){
		else if((_main_mn_pos_crnt == POP_POS_VGA)&&(cmn_vga_det)){
			WriteOSDStrY(MASTER,_pos_x,_pos_y+0,0x00,str_wndw_pop_sb_out_rs);
			WriteOSDStrY(MASTER,_pos_x,_pos_y+1,0x00,str_wndw_pop_sb_de_int);
			WriteOSDStrY(MASTER,_pos_x,_pos_y+2,0x00,str_wndw_pop_sb_img_en);
			WriteOSDStrY(MASTER,_pos_x,_pos_y+3,0x00,str_wndw_pop_sb_ns_rd);
		}
#endif
	}
//	IfBitSet(_pth,PTH_Y){
	if(BitSet(_pth,PTH_Y)){
		if(_main_mn_pos_crnt == POP_POS_RC){
			WriteOSDStrY(MASTER,_pos_x,_pos_y+0,0x00,str_wndw_pop_sb_fmt);
			WriteOSDStrY(MASTER,_pos_x,_pos_y+1,0x00,str_wndw_pop_sb_indx);
			WriteOSDStrY(MASTER,_pos_x,_pos_y+2,0x00,str_wndw_pop_sb_ns_rd);
		}
#if defined(__WTH_ADO__)
		else if(_main_mn_pos_crnt == POP_POS_ADO){
			WriteOSDStrY(MASTER,_pos_x,_pos_y+0,0x00,str_wndw_pop_sb_gn);
			WriteOSDStrY(MASTER,_pos_x,_pos_y+1,0x00,str_wndw_pop_sb_lv);
			WriteOSDStrY(MASTER,_pos_x,_pos_y+2,0x00,str_wndw_pop_sb_rc);
//			WriteOSDStrY(MASTER,_pos_x,_pos_y+3,0x00,str_wndw_pop_sb_dt);
		}
#elif defined(__WTH_VGA__)
//		else if(_main_mn_pos_crnt == POP_POS_VGA){
		else if((_main_mn_pos_crnt == POP_POS_VGA)){//&&(cmn_vga_det)){
			WriteOSDStrY(MASTER,_pos_x,_pos_y+0,0x00,str_wndw_pop_sb_out_rs);
			WriteOSDStrY(MASTER,_pos_x,_pos_y+1,0x00,str_wndw_pop_sb_de_int);
			WriteOSDStrY(MASTER,_pos_x,_pos_y+2,0x00,str_wndw_pop_sb_img_en);
			WriteOSDStrY(MASTER,_pos_x,_pos_y+3,0x00,str_wndw_pop_sb_ns_rd);
		}
#endif
	}
}
//==================================================================================
void SetPopSub(U8 _pth, U8 _pos_x, U8 _pos_y, U8 _lngth, U8 _hght, U8 _main_mn_pos_crnt)
{                                                                                                   //Drawing sub box and downloading property OSD string for sub 
//	_lngth = 0;			//... temporal
//	_hght = 0;			//... temporal
	CreateBoxPopFrame(_pth,BOX_POP_SB,_pos_x,_pos_y,_lngth,_hght);
//	IfBitSet(_pth,PTH_X)	SetPopSubOSD(PTH_X,_pos_x,_pos_y, _main_mn_pos_crnt);
//	IfBitSet(_pth,PTH_Y)	SetPopSubOSD(PTH_Y,_pos_x,_pos_y, _main_mn_pos_crnt);
	if(BitSet(_pth,PTH_X))	SetPopSubOSD(PTH_X,_pos_x,_pos_y, _main_mn_pos_crnt);
	if(BitSet(_pth,PTH_Y))	SetPopSubOSD(PTH_Y,_pos_x,_pos_y, _main_mn_pos_crnt);
}
*/
//==================================================================================
//==================================================================================
/*void RemovePopMain(void)
{
		mse_osd_x = 16;//45;//GetMseOSDX(reg_crsr_pos_x);
		mse_osd_y = 12;//56;//GetMseOSDY(reg_crsr_pos_y);
//	if(b_mse_stts_pth_pop == MSE_PTH_X){
		DisableBox(PTH_X,BOX_POP_MN_HL);
		DisableBox(PTH_X,BOX_POP_MN);
		DisableBox(PTH_X,BOX_POP_SB_HL);
		DisableBox(PTH_X,BOX_POP_SB);
//		WriteOSDClrX(MASTER,mse_osd_x,mse_osd_y,POP_MN_NUM_H,POP_MN_NUM_V);//+cmn_vga_det);//change to x path for test (070904)
		WriteOSDClrY(MASTER,mse_osd_x,mse_osd_y,POP_MN_NUM_H+4,POP_MN_NUM_V+2);//+cmn_vga_det);	//... 060307:temporal
//	}
//	else{
//		DisableBox(PTH_Y,BOX_POP_MN_HL);
//		DisableBox(PTH_Y,BOX_POP_MN);
//		WriteOSDClrY(MASTER,mse_osd_x,mse_osd_y,POP_MN_NUM_H,POP_MN_NUM_V);//+cmn_vga_det);
//	}

//	b_mse_stts_pth_pop = b_mse_stts_pth;
}*/
//==================================================================================
/*void CreatePopMain(void)
{
	U8 _pop_num_h_, _pop_num_v_;
	U8 N_P;

	if(b_video_fmt == PAL) N_P = 0;
	else N_P = 2;
	
	RemovePopMain();
//	mse_osd_x = 16;//45;//GetMseOSDX(reg_crsr_pos_x);
//	mse_osd_y = 12;//56;//GetMseOSDY(reg_crsr_pos_y);

	_pop_num_h_ = POP_MN_NUM_H+4;
	_pop_num_v_ = POP_MN_NUM_V+2;//+ cmn_vga_det;
	SetPopMain(PTH_X,mse_osd_x,mse_osd_y,_pop_num_h_,_pop_num_v_);

	CreateBoxPopHL(PTH_X,BOX_POP_MN_HL,mse_osd_x,mse_osd_y,_pop_num_h_);
}*/
//==================================================================================
void RemoveOSDFnt(U8 h_left, U16 v_top, U8 h_right, U16 v_bottom)
{
//	mse_osd_x = 0;
//	mse_osd_y = 0;
	WriteOSDClr(PTH_X,MASTER, h_left, v_top, h_right, v_bottom /*89,287*/);//WNDW_DS_SC_L+38,WNDW_DS_SC_H+38);//+cmn_vga_det);//change to x path for test (070904)
	WriteOSDClr(PTH_Y,MASTER, h_left, v_top, h_right, v_bottom /*89,287*/);//WNDW_DS_SC_L+38,WNDW_DS_SC_H+38);	//... 060307:temporal
}
//==================================================================================
/*void CreatePopSub(U8 _main_mn_pos_crnt)
{
	U16 _osd_lmt_v_ = cmn_bot<<1;

	U8 _osd_lmt_x_;
	U8 _pop_main_num_h_;
	U8 _pth_;

	_osd_lmt_v_ = (_osd_lmt_v_-OSD_DLY_V)/10;

//	if(b_mse_stts_pth_pop == MSE_PTH_X){
		_pth_ = PTH_X;
//	}
//	else{
		_pth_ = PTH_Y;
//	}
	
//	_pth_ = PTH_Y;																		//... 060307:temporal
	
	_pop_main_num_h_ = POP_MN_NUM_H;
	_osd_lmt_x_ = 45 - (_pop_main_num_h_+wndw_pop_sub_num_h+1);

//	mse_osd_y_sub = GetMseOSDY(reg_crsr_pos_y);

	if(mse_osd_x > _osd_lmt_x_)	mse_osd_x_sub = mse_osd_x-wndw_pop_sub_num_h-1;
	else	mse_osd_x_sub = mse_osd_x+_pop_main_num_h_+1;
	if(mse_osd_y_sub > (_osd_lmt_v_-wndw_pop_sub_num_v))	mse_osd_y_sub = _osd_lmt_v_-wndw_pop_sub_num_v;
	SetPopSub(_pth_,mse_osd_x_sub,mse_osd_y_sub,wndw_pop_sub_num_h,wndw_pop_sub_num_v,_main_mn_pos_crnt);
	CreateBoxPopHL(_pth_,BOX_POP_SB_HL,mse_osd_x_sub,mse_osd_y_sub,wndw_pop_sub_num_h);
}*/
//==================================================================================
//==================================================================================
/*
void RunPopProc(void)
{
	U8 _osd_pos_x_, _osd_pos_y_;
	U8 _pop_main_num_h_, _pop_main_num_v_;
	U8 _mn_crnt_pos_main_, _mn_crnt_pos_sub_;

	_osd_pos_x_ = GetMseOSDX(reg_crsr_pos_x);
	_osd_pos_y_ = GetMseOSDY(reg_crsr_pos_y);

	_pop_main_num_h_ = POP_MN_NUM_H;                             //=9
	_pop_main_num_v_ = POP_MN_NUM_V + cmn_vga_det;   //=5
	
	if(((_osd_pos_x_ >= mse_osd_x)&&(_osd_pos_x_ <= (mse_osd_x+_pop_main_num_h_))&&
		(_osd_pos_y_ >= mse_osd_y)&&(_osd_pos_y_ < (mse_osd_y+_pop_main_num_v_)))//){
		&&	(b_mse_stts_pth_pop == b_mse_stts_pth)){
		
		SetBoxPopHLPos(BOX_POP_MN_HL,mse_osd_x,_osd_pos_y_,_pop_main_num_h_);
		_mn_crnt_pos_main_ = _osd_pos_y_ - mse_osd_y;

		if(wndw_mn_pos_crnt != _mn_crnt_pos_main_){
			wndw_mn_pos_crnt = _mn_crnt_pos_main_;

			RemovePopSub();

			if(b_mse_stts_pth_pop == MSE_PTH_X){
				if(_mn_crnt_pos_main_ == POP_POS_DS){
					wndw_pop_sub_num_h = 6;
					wndw_pop_sub_num_v = 4;
					CreatePopSub(_mn_crnt_pos_main_);
				}
				else if(_mn_crnt_pos_main_ == POP_POS_MTN){
					wndw_pop_sub_num_h = 6;
					wndw_pop_sub_num_v = 3;
					CreatePopSub(_mn_crnt_pos_main_);
				}
#if defined(__WTH_ADO__)
				else if(_mn_crnt_pos_main_ == POP_POS_ADO){
					wndw_pop_sub_num_h = 6;
					wndw_pop_sub_num_v = 3;//4;
					CreatePopSub(_mn_crnt_pos_main_);
				}
#elif defined(__WTH_VGA__)
				else if((_mn_crnt_pos_main_ == POP_POS_VGA)&&(cmn_vga_det)){
					wndw_pop_sub_num_h = 11;//15;
					wndw_pop_sub_num_v = 4;
					CreatePopSub(_mn_crnt_pos_main_);
				}
#endif
				else{
					wndw_pop_sub_num_h = 0;
					wndw_pop_sub_num_v = 0;
				}
			}
			else{
				if(_mn_crnt_pos_main_ == POP_POS_RC){
					wndw_pop_sub_num_h = 6;
					wndw_pop_sub_num_v = 3;
					CreatePopSub(_mn_crnt_pos_main_);
				}
#if defined(__WTH_ADO__)
				else if(_mn_crnt_pos_main_ == POP_POS_ADO){
					wndw_pop_sub_num_h = 6;
					wndw_pop_sub_num_v = 3;//4;
					CreatePopSub(_mn_crnt_pos_main_);
				}
#elif defined(__WTH_VGA__)
//				else if(_mn_crnt_pos_main_ == POP_POS_VGA){
				else if((_mn_crnt_pos_main_ == POP_POS_VGA)&&(cmn_vga_det)){
					wndw_pop_sub_num_h = 11;//15;
					wndw_pop_sub_num_v = 4;
					CreatePopSub(_mn_crnt_pos_main_);
				}
#endif
				else{
					wndw_pop_sub_num_h = 0;
					wndw_pop_sub_num_v = 0;
				}
			}
		}		

//...		left button function
		if(b_mse_btn_dwn_lb == 1){
			b_mse_btn_dwn_lb = 0;
		}
		if(b_mse_clk_lb == 1){
			b_mse_clk_lb = 0;
			if(_mn_crnt_pos_main_ == POP_POS_MTN){
			}
#if defined(__WTH_ADO__)
			else if(_mn_crnt_pos_main_ == POP_POS_ADO){
				//... no operation
			}
#endif
			else{
					//... no operation
				if((_mn_crnt_pos_main_ == POP_POS_DS)&&(b_mse_stts_pth_pop == MSE_PTH_X)){
					//... no operation
				}
				else if((_mn_crnt_pos_main_ == POP_POS_RC)&&(b_mse_stts_pth_pop == MSE_PTH_Y)){
					//... no operation
				}
#if defined(__WTH_VGA__)
				else if((_mn_crnt_pos_main_ == POP_POS_VGA)&&(cmn_vga_det)){
					//... no operation
				}
#endif
				else{
					RemovePopMain();
					b_cmn_wndw_pop = OFF;		
					b_mse_stts_pth_mn = b_mse_stts_pth_pop;
					if(b_mse_stts_pth_mn == MSE_PTH_X){
						if(_mn_crnt_pos_main_ == POP_POS_RC){
							b_mse_stts_pth = MSE_PTH_Y;						//... change to record path
	
							WriteAsicByte(MASTER,DVC_PG1,0xa0,0xbb);
							WriteAsicByte(MASTER,DVC_PG1,0xa1,0x76);   //... s-video (y path)	//... 060705:temporal   
//							WriteAsicByte(MASTER,DVC_PG1,0xa2,0x97);	//... cvbs (x path)
							WriteAsicByte(MASTER,DVC_PG1,0xa2,0xd7);	//... cvbs (y path)
							WriteAsicByte(MASTER,DVC_PG1,0xa3,0x10);	//... 656 output

							SetOSDNoMn();

							wndw_mn_pos_crnt = 30;
						}
						else if(_mn_crnt_pos_main_ == (POP_POS_RG+cmn_vga_det))		CreateWndwRg(PTH_Y);
					}
					else{
						if(_mn_crnt_pos_main_ == POP_POS_DS){
							b_mse_stts_pth = MSE_PTH_X;						//... change to display path

							WriteAsicByte(MASTER,DVC_PG1,0xa0,0x66);
							WriteAsicByte(MASTER,DVC_PG1,0xa1,0x32);	//... s-video (x path)	//... 060705:temporal
//							WriteAsicByte(MASTER,DVC_PG1,0xa2,0xd7);	//... cvbs (y path)
							WriteAsicByte(MASTER,DVC_PG1,0xa2,0x97);	//... cvbs (x path)
							WriteAsicByte(MASTER,DVC_PG1,0xa3,0x01);	//... 656 output

							SetOSDNoMn();

							wndw_mn_pos_crnt = 30;
						}
						else if(_mn_crnt_pos_main_ == (POP_POS_RG+cmn_vga_det))			CreateWndwRg(PTH_Y);
					}
				}
			}
		}
		if(b_mse_pshng_clk_lb == 1){
			b_mse_pshng_clk_lb = 0;
		}
		
//...		right button function
		if(b_mse_btn_dwn_rb == 1){
			b_mse_btn_dwn_rb = 0;
		}
		if(b_mse_clk_rb == 1){
			b_mse_clk_rb = 0;
		}
		if(b_mse_pshng_clk_rb == 1){
			b_mse_pshng_clk_rb = 0;
		}
	}
	else if(((_osd_pos_x_ >= mse_osd_x_sub)&&(_osd_pos_x_ <= (mse_osd_x_sub+wndw_pop_sub_num_h))&&
		(_osd_pos_y_ >= mse_osd_y_sub)&&(_osd_pos_y_ < (mse_osd_y_sub+wndw_pop_sub_num_v)))//){
		&&	(b_mse_stts_pth_pop == b_mse_stts_pth)){
		
		SetBoxPopHLPos(BOX_POP_SB_HL,mse_osd_x_sub,_osd_pos_y_,wndw_pop_sub_num_h);
		_mn_crnt_pos_sub_ = _osd_pos_y_ - mse_osd_y_sub;

//...		left button function
		if(b_mse_btn_dwn_lb == 1){
			b_mse_btn_dwn_lb = 0;
		}
		if(b_mse_clk_lb == 1){
			b_mse_clk_lb = 0;
			
			_mn_crnt_pos_main_ = wndw_mn_pos_crnt&0x0f;
			wndw_mn_pos_crnt |= _mn_crnt_pos_sub_<<4;

			RemovePopSub();
			RemovePopMain();
			b_cmn_wndw_pop = OFF;

			b_mse_stts_pth_mn = b_mse_stts_pth_pop;
			if(b_mse_stts_pth_mn == MSE_PTH_X){
				if(wndw_mn_pos_crnt == POP_POS_DS_SC)		CreateWndwDsSc(PTH_Y);
				else if(wndw_mn_pos_crnt == POP_POS_DS_SR){
#if defined(__4CH__)
					if((wndw_ds_sc_fmt == SC_FMT_4CH)&&(b_ds_wth_4pb)){
						//... no operation
					}
#elif defined(__16CH__)
					if((wndw_ds_sc_fmt == SC_FMT_16CH)&&(b_ds_wth_16pb)){
						//... no operation
					}
#endif
					else	CreateWndwDsSr(PTH_Y);
				}
				else if(wndw_mn_pos_crnt == POP_POS_DS_IN)			CreateWndwDsIn(PTH_Y);
				else if(wndw_mn_pos_crnt == POP_POS_ZM)			CreateWndwZm();

				else if(wndw_mn_pos_crnt == POP_POS_MTN_MD)		CreateWndwMtnMd(PTH_Y);
				else if(wndw_mn_pos_crnt == POP_POS_MTN_BD)		CreateWndwMtnBdNd(PTH_Y);
				else if(wndw_mn_pos_crnt == POP_POS_MTN_ND)		CreateWndwMtnBdNd(PTH_Y);

#if defined(__WTH_ADO__)
				else if(wndw_mn_pos_crnt == POP_POS_ADO_GN)		CreateWndwAdoGn(PTH_Y);
				else if(wndw_mn_pos_crnt == POP_POS_ADO_LV)		CreateWndwAdoLv(PTH_Y);
				else if(wndw_mn_pos_crnt == POP_POS_ADO_RC)		CreateWndwAdoRc(PTH_Y);
#elif defined(__WTH_VGA__)
				if((_mn_crnt_pos_main_ == POP_POS_VGA)&&(cmn_vga_det)){
					if(wndw_mn_pos_crnt == POP_POS_VGA_OR)		CreateWndwVGAOr(PTH_Y);
					else if(wndw_mn_pos_crnt == POP_POS_VGA_DI)	CreateWndwVGADi(PTH_Y);
					else if(wndw_mn_pos_crnt == POP_POS_VGA_IE)	CreateWndwVGAIe(PTH_Y);
					else if(wndw_mn_pos_crnt == POP_POS_VGA_NR)	CreateWndwVGANr(PTH_Y);
				}
#endif
			}
			else{
				if(wndw_mn_pos_crnt == POP_POS_RC_FM)				CreateWndwRcFm(PTH_Y);
				else if(wndw_mn_pos_crnt == POP_POS_RC_IN)			CreateWndwRcIn(PTH_Y);
				else if(wndw_mn_pos_crnt == POP_POS_RC_NR)			CreateWndwRcNr(PTH_Y);

#if defined(__WTH_ADO__)
				else if(wndw_mn_pos_crnt == POP_POS_ADO_GN)		CreateWndwAdoGn(PTH_Y);
				else if(wndw_mn_pos_crnt == POP_POS_ADO_LV)		CreateWndwAdoLv(PTH_Y);
				else if(wndw_mn_pos_crnt == POP_POS_ADO_RC)		CreateWndwAdoRc(PTH_Y);
#elif defined(__WTH_VGA__)
				if((_mn_crnt_pos_main_ == POP_POS_VGA)&&(cmn_vga_det)){
					if(wndw_mn_pos_crnt == POP_POS_VGA_OR)		CreateWndwVGAOr(PTH_Y);
					else if(wndw_mn_pos_crnt == POP_POS_VGA_DI)	CreateWndwVGADi(PTH_Y);
					else if(wndw_mn_pos_crnt == POP_POS_VGA_IE)	CreateWndwVGAIe(PTH_Y);
					else if(wndw_mn_pos_crnt == POP_POS_VGA_NR)	CreateWndwVGANr(PTH_Y);
				}
#endif
			}
		}
		if(b_mse_pshng_clk_lb == 1){
			b_mse_pshng_clk_lb = 0;
		}
		
//...		right button function
		if(b_mse_btn_dwn_rb == 1){
			b_mse_btn_dwn_rb = 0;
		}
		if(b_mse_clk_rb == 1){
			b_mse_clk_rb = 0;
		}
		if(b_mse_pshng_clk_rb == 1){
			b_mse_pshng_clk_rb = 0;
		}
	}
	else{
//...		left button function
		if(b_mse_btn_dwn_lb == 1){
			b_mse_btn_dwn_lb = 0;
		}
		if(b_mse_clk_lb == 1){
			b_mse_clk_lb = 0;

			RemovePopSub();
			RemovePopMain();

			SetOSDNoMn();

			wndw_mn_pos_crnt = 30;
			b_cmn_wndw_pop = OFF;
		}
		if(b_mse_pshng_clk_lb == 1){
			b_mse_pshng_clk_lb = 0;
		}

//...		right button function
		if(b_mse_btn_dwn_rb == 1){
			b_mse_btn_dwn_rb = 0;
		}
		if(b_mse_clk_rb == 1){
			b_mse_clk_rb = 0;

			RemovePopSub();
			CreatePopMain();
			wndw_mn_pos_crnt = 30;
		}
		if(b_mse_pshng_clk_rb == 1){
			b_mse_pshng_clk_rb = 0;
		}
	}
}
*/
//==================================================================================

